<template>
	<view class="warp">
		<view class="uni-margin-wrap">
			<view class="notice-list-body">
				<view class="uni-list">
					<block v-for="(value, index) in list" :key="index">
						<view class="uni-list-cell" hover-class="uni-list-cell-hover">
							<view class="uni-media-list">
								<image class="uni-media-list-logo" src="../../../static/message/news_01.png"></image>
			
								<view class="uni-media-list-body">
									<view class="uni-media-list-text-top">
										<text class="text">{{ value.name }}</text>
									</view>
									<view class="uni-media-list-text-top">
										<text class="text2">{{ value.content }}</text>
									</view>
									<view class="uni-media-list-text-bottom">
										<text class="text">{{$util.timeStampTurnTime(value.createtime)}}</text>
									</view>
								</view>
							</view>
						</view>
					</block>
				</view>
			</view>
		</view>
		
		<uni-load-more :status="status" :icon-size="16" :content-text="contentText" />
	</view>
</template>

<script>
export default {
	data() {
		return {
			list:[],
			page:1,
			reload: false,
			status: 'more',
			contentText: {
				contentdown: '上拉加载更多',
				contentrefresh: '加载中',
				contentnomore: '没有更多'
			}
		};
	},
	onPullDownRefresh() {
		this.reload = true;
		this.page = 1;
		this.getMessageDiscountData();
	},
	onReachBottom() {
		this.status = 'more';
		this.page ++;
		this.getMessageDiscountData();
	},
	onLoad() {
		this.getMessageDiscountData();
	},
	methods: {
		  
		getMessageDiscountData() {
			var data = {
				page:'1',
				keyword:'',
				limit:'20'
			};
			
			if (this.page > 1) {
				//说明已有数据，目前处于上拉加载
				this.status = 'loading';
				data.page = this.page + '';
			}
			
			// this.http.sendRequest({
			// 	api: this.api.home.messageDiscountApi,
			// 	data: data,
			// 	success: res => {
			// 		console.log(res)
			// 		if (res.success == 'true' && res.data) {
			// 			this.list = this.reload ? res.data.data : this.list.concat(res.data.data);
			// 			this.reload = false;
			// 		}
			// 	}
			// });
		},
	}
};
</script>

<style lang="scss">
	@import '../public/css/notice.scss';
</style>
